package service

import (
	"api-gateway/basic/config"
	__ "api-gateway/basic/proto/rpc"
	"api-gateway/handler/request"
	"github.com/gin-gonic/gin"
	"net/http"
)

func PublishVideo(c *gin.Context) {
	var form request.PublishVideo
	if err := c.ShouldBind(&form); err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"code": 400, "msg": "参数错误"})
		return
	}
}
func GetVideoList(c *gin.Context) {
	list, err := config.VideoRpcClient.GetVideoList(c, &__.GetVideoListReq{})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"code": 400, "msg": "查询失败"})
		return
	}
	c.JSON(http.StatusOK, gin.H{"code": 200, "msg": "查询成功", "data": gin.H{
		"list": list,
	}})
	return
}
func GetHistory(c *gin.Context) {
	list, err := config.VideoRpcClient.GetHistory(c, &__.GetHistoryReq{})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"code": 400, "msg": "查询失败"})
		return
	}
	c.JSON(http.StatusOK, gin.H{"code": 200, "msg": "查询成功", "data": gin.H{
		"list": list,
	}})
	return
}
func FindHis(c *gin.Context) {
	list, err := config.VideoRpcClient.FindHis(c, &__.FindHisReq{})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"code": 400, "msg": "查询失败"})
		return
	}
	c.JSON(http.StatusOK, gin.H{"code": 200, "msg": "查询成功", "data": gin.H{
		"list": list,
	}})
	return
}
